<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>【{$match}】比赛列表</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('child', array('game'=>$game,'id'=>$id))}">新 增</a>
            <button class="btn btn-default ajax-post" url="{:U('itemStatus',array('method'=>'resume'))}" target-form="ids">启 用</button>
            <button class="btn btn-default ajax-post" url="{:U('itemStatus',array('method'=>'forbid'))}" target-form="ids">禁 用</button>
            <button class="btn ajax-post confirm btn-danger" url="{:U('itemDel')}" target-form="ids">删 除</button>
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" style="float:left;" class="text time" name="date" 
                <notempty name="date"> value="{$date}"</notempty>
                placeholder="赛事时间">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="标题关键字">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('items', array('game'=>$game,'id'=>$id))}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
    <table class="table table-bordered">
    <thead>
        <tr>
        <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
        <th>ID</th>
        <th class="">比赛名称</th>
       <!-- <th class="">封面</th> -->
        <th class="">赛程</th>
        <th class="">队伍</th>
        <th class="">胜负比</th>
        <th class="">人头比</th>
        <th class="">状态</th>
        <th class="">操作</th>
        </tr>
    </thead>
    <tbody>
        <notempty name="_list">
        <volist name="_list" id="vo">
        <tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
            <td>{$vo.id}</td>
            <td>{$vo.title} </td>
          <!--  <td>
                <div class="upload-img-box">
                <notempty name="vo.thumb">
                    <div class="upload-pre-item"><img src="__ROOT__{$vo.thumb}"/></div>
                </notempty>
                </div>
            </td> -->
            <td>{$vo.match_time|date="Y-m-d",###}</td>
            <td>{$vo.joiners}</td>
            <td>{$vo.score}</td>
            <td>{$vo.score_point}</td>
            <td>{$vo.status_text}</td>
            <td>
                <a href="{:U('video?id='.$vo['id'])}">视频 ( {:count($vo['match_videos'])} ) </a>
                <a href="{:U('editItems?id='.$vo['id'].'&game='.$game)}">编辑</a>
                <a href="{:U('itemDel?id='.$vo['id'])}" class="confirm ajax-get">删除</a>
            </td>
        </tr>
        </volist>
        <else/>
        <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
        </notempty>
    </tbody>
    </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        $(function(){
                $('.time').datetimepicker({
                    format: 'yyyy-mm-dd',
                    language:"zh-CN",
                    minView:2,
                    autoclose:true
                });
        });

        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('Game/index')}');
    </script>
</block>
